3.2.62 \(\int \csc ^2(e+f x) (a+b \sin (e+f x))^2 \, dx\) [162]

Optimal. Leaf size=34 \[ b^2 x-\frac {2 a b \tanh ^{-1}(\cos (e+f x))}{f}-\frac {a^2 \cot (e+f x)}{f} \]

[Out]

b^2*x-2*a*b*arctanh(cos(f*x+e))/f-a^2*cot(f*x+e)/f

________________________________________________________________________________________

Rubi [A]
time = 0.05, antiderivative size = 34, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {2868, 3855, 3091, 8} \begin {gather*} -\frac {a^2 \cot (e+f x)}{f}-\frac {2 a b \tanh ^{-1}(\cos (e+f x))}{f}+b^2 x \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Csc[e + f*x]^2*(a + b*Sin[e + f*x])^2,x]

[Out]

b^2*x - (2*a*b*ArcTanh[Cos[e + f*x]])/f - (a^2*Cot[e + f*x])/f

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2868

Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Dist[2*c*(d/b)
, Int[(b*Sin[e + f*x])^(m + 1), x], x] + Int[(b*Sin[e + f*x])^m*(c^2 + d^2*Sin[e + f*x]^2), x] /; FreeQ[{b, c,
 d, e, f, m}, x]

Rule 3091

Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((A_) + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[A*Cos[e +
 f*x]*((b*Sin[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Dist[(A*(m + 2) + C*(m + 1))/(b^2*(m + 1)), Int[(b*Sin[e
+ f*x])^(m + 2), x], x] /; FreeQ[{b, e, f, A, C}, x] && LtQ[m, -1]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin {align*} \int \csc ^2(e+f x) (a+b \sin (e+f x))^2 \, dx &=(2 a b) \int \csc (e+f x) \, dx+\int \csc ^2(e+f x) \left (a^2+b^2 \sin ^2(e+f x)\right ) \, dx\\ &=-\frac {2 a b \tanh ^{-1}(\cos (e+f x))}{f}-\frac {a^2 \cot (e+f x)}{f}+b^2 \int 1 \, dx\\ &=b^2 x-\frac {2 a b \tanh ^{-1}(\cos (e+f x))}{f}-\frac {a^2 \cot (e+f x)}{f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(76\) vs. \(2(34)=68\).
time = 0.17, size = 76, normalized size = 2.24 \begin {gather*} \frac {-a^2 \cot \left (\frac {1}{2} (e+f x)\right )+2 b \left (b e+b f x-2 a \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )+2 a \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )\right )+a^2 \tan \left (\frac {1}{2} (e+f x)\right )}{2 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Csc[e + f*x]^2*(a + b*Sin[e + f*x])^2,x]

[Out]

(-(a^2*Cot[(e + f*x)/2]) + 2*b*(b*e + b*f*x - 2*a*Log[Cos[(e + f*x)/2]] + 2*a*Log[Sin[(e + f*x)/2]]) + a^2*Tan
[(e + f*x)/2])/(2*f)

________________________________________________________________________________________

Maple [A]
time = 0.23, size = 46, normalized size = 1.35

method result size
derivativedivides \(\frac {-a^{2} \cot \left (f x +e \right )+2 a b \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )+b^{2} \left (f x +e \right )}{f}\) \(46\)
default \(\frac {-a^{2} \cot \left (f x +e \right )+2 a b \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )+b^{2} \left (f x +e \right )}{f}\) \(46\)
risch \(b^{2} x -\frac {2 i a^{2}}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )}-\frac {2 a b \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )}{f}+\frac {2 a b \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right )}{f}\) \(67\)
norman \(\frac {b^{2} x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+b^{2} x \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )-\frac {a^{2}}{2 f}-\frac {a^{2} \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 f}+\frac {a^{2} \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 f}+\frac {a^{2} \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 f}+2 b^{2} x \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) \left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{2}}+\frac {2 a b \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}\) \(159\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(f*x+e)^2*(a+b*sin(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

1/f*(-a^2*cot(f*x+e)+2*a*b*ln(csc(f*x+e)-cot(f*x+e))+b^2*(f*x+e))

________________________________________________________________________________________

Maxima [A]
time = 0.28, size = 56, normalized size = 1.65 \begin {gather*} \frac {{\left (f x + e\right )} b^{2} - a b {\left (\log \left (\cos \left (f x + e\right ) + 1\right ) - \log \left (\cos \left (f x + e\right ) - 1\right )\right )} - \frac {a^{2}}{\tan \left (f x + e\right )}}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)^2*(a+b*sin(f*x+e))^2,x, algorithm="maxima")

[Out]

((f*x + e)*b^2 - a*b*(log(cos(f*x + e) + 1) - log(cos(f*x + e) - 1)) - a^2/tan(f*x + e))/f

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 84 vs. \(2 (36) = 72\).
time = 0.41, size = 84, normalized size = 2.47 \begin {gather*} \frac {b^{2} f x \sin \left (f x + e\right ) - a b \log \left (\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) \sin \left (f x + e\right ) + a b \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) \sin \left (f x + e\right ) - a^{2} \cos \left (f x + e\right )}{f \sin \left (f x + e\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)^2*(a+b*sin(f*x+e))^2,x, algorithm="fricas")

[Out]

(b^2*f*x*sin(f*x + e) - a*b*log(1/2*cos(f*x + e) + 1/2)*sin(f*x + e) + a*b*log(-1/2*cos(f*x + e) + 1/2)*sin(f*
x + e) - a^2*cos(f*x + e))/(f*sin(f*x + e))

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \sin {\left (e + f x \right )}\right )^{2} \csc ^{2}{\left (e + f x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)**2*(a+b*sin(f*x+e))**2,x)

[Out]

Integral((a + b*sin(e + f*x))**2*csc(e + f*x)**2, x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 79 vs. \(2 (36) = 72\).
time = 0.46, size = 79, normalized size = 2.32 \begin {gather*} \frac {2 \, {\left (f x + e\right )} b^{2} + 4 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) \right |}\right ) + a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - \frac {4 \, a b \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + a^{2}}{\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)^2*(a+b*sin(f*x+e))^2,x, algorithm="giac")

[Out]

1/2*(2*(f*x + e)*b^2 + 4*a*b*log(abs(tan(1/2*f*x + 1/2*e))) + a^2*tan(1/2*f*x + 1/2*e) - (4*a*b*tan(1/2*f*x +
1/2*e) + a^2)/tan(1/2*f*x + 1/2*e))/f

________________________________________________________________________________________

Mupad [B]
time = 6.83, size = 105, normalized size = 3.09 \begin {gather*} \frac {2\,b^2\,\mathrm {atan}\left (\frac {b\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+2\,a\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{2\,a\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-b\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f}-\frac {a^2\,\mathrm {cot}\left (e+f\,x\right )}{f}+\frac {2\,a\,b\,\ln \left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*sin(e + f*x))^2/sin(e + f*x)^2,x)

[Out]

(2*b^2*atan((b*cos(e/2 + (f*x)/2) + 2*a*sin(e/2 + (f*x)/2))/(2*a*cos(e/2 + (f*x)/2) - b*sin(e/2 + (f*x)/2))))/
f - (a^2*cot(e + f*x))/f + (2*a*b*log(sin(e/2 + (f*x)/2)/cos(e/2 + (f*x)/2)))/f

________________________________________________________________________________________